<?php
namespace app\admin\controller;

class Patchcat extends Base
{
    //添加碎片分类
    public function add(){
        if(is_post()){
            $d = $this->post;
            $rule = [
                'cat_title'=>'require',
                'uuid'=>'require',
            ];
            $msg = [];
            check($rule,$msg,$d);
            $data = [
                "uuid" => $d["uuid"],
                "cat_title" => $d["cat_title"],
                "create_time" => time(),
            ];
            $rs = $cat_id = $this->db->insert("patch_cat",$data);
            if ($rs) {
                cookie('js_msg','添加成功');
                cookie('js_function','preload');
                return suc();
            }else{
                err('添加失败');
            }
        }
        $this->fetch([],"");
    }

}
